const userInfoFromRow = [{
    span: 20,
    label: '用户名',
    component: 'AInput',
    placeholder: '请输入用户名',
    prop: 'userName',
    allowClear: true,
    disabled: true,
  },
  {
    span: 20,
    label: '手机号',
    component: 'AInput',
    placeholder: '请输入手机号',
    prop: 'phonenumber',
    allowClear: true,
  },
  {
    span: 20,
    label: '联系邮箱',
    component: 'AInput',
    placeholder: '请输入邮箱',
    prop: 'email',
    allowClear: true,
    disabled: true,
  },
  {
    span: 20,
    label: '性别',
    component: 'ARadioGroup',
    prop: 'sex',
    radioList: [{
        label: '男',
        value: '0'
      },
      {
        label: '女',
        value: '1'
      },
      {
        label: '保密',
        value: '2'
      }
    ],
  },
  {
    span: 20,
    label: '所在区域',
    component: 'Acascader',
    prop: 'address',
    allowClear: true,
  },
  {
    span: 20,
    label: '个人简介',
    component: 'ATextArea',
    placeholder: '请输入个人简介',
    prop: 'intro',
    allowClear: true,
  },
  {
    span: 20,
    label: 'QQ',
    component: 'AInput',
    placeholder: '请输入QQ',
    prop: 'qq',
    allowClear: true,
  },
];

const companyFromRow = [{
    span: 12,
    label: '企业名称',
    component: 'AInput',
    placeholder: '请输入机构地址',
    prop: 'enpName',
    allowClear: true,
  },
  {
    span: 12,
    label: '邮箱',
    component: 'AInput',
    placeholder: '请输入邮箱',
    prop: 'email',
    allowClear: true,
    disabled: true,
  },
  {
    span: 12,
    label: '联系电话',
    component: 'AInput',
    placeholder: '请输入联系电话',
    prop: 'enpPhone',
    allowClear: true,
  },
  {
    span: 12,
    label: '联系人',
    component: 'AInput',
    placeholder: '请输入联系人',
    prop: 'enpContact',
    allowClear: true,
  },
  // {
  //   span: 24,
  //   label: '企业类型',
  //   placeholder: '请输入企业类型',
  //   prop: 'enpType',
  //   component: 'ARadioGroup',
  //   radioList: [{
  //       label: '国企/事业单位 ',
  //       value: '0'
  //     },
  //     {
  //       label: '外企/合资企业 ',
  //       value: '1'
  //     },
  //     {
  //       label: '民营企业',
  //       value: '2'
  //     },
  //     {
  //       label: '其他',
  //       value: '3'
  //     }
  //   ],
  // },
  {
    span: 24,
    label: '统一社会信用代码(营业执照号码)',
    component: 'AInput',
    placeholder: '请输入统一社会信用代码',
    prop: 'enpNo',
    allowClear: true,
  },
  {
    span: 12,
    label: '官网地址',
    component: 'AInput',
    placeholder: '请输入官网地址',
    prop: 'enpUrl',
    allowClear: true,
  }, {
    span: 12,
    label: '成立日期',
    component: 'ADate',
    placeholder: '请输入成立日期',
    prop: 'enpDate',
    allowClear: true,
  },

  {
    span: 24,
    label: '地址',
    component: 'AcascaderInput',
    placeholder: '请输入地址',
    prop: 'companyAddress',
    allowClear: true,
  },
  {
    span: 24,
    label: '企业描述',
    component: 'ATextArea',
    placeholder: '请输入企业描述',
    prop: 'enpDesc',
    allowClear: true,
  },
  {
    span: 12,
    label: '企业LOGO',
    component: 'AUpload',
    prop: 'logo'
  },
  {
    span: 12,
    label: '营业执照上传',
    component: 'AUpload',
    prop: 'enpPic'
  },
  // {
  //   span: 12,
  //   label: '示例',
  //   component: 'AUpload',
  //   prop: 'picPath',
  //   disabled: true
  // },
];
var reg = new RegExp(
  /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/
); // 校验手机号和电话
// var reg2 = new RegExp(/^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g); // 社会信用代码

const formRules = {
  userName: [{
    required: true,
    message: '用户名不能为空',
    trigger: 'blur'
  }],
  phonenumber: [{
    required: true,
    message: '手机号不能为空',
    trigger: 'blur',
  }, {
    validator: (rule, val, callback) => {
      if (!reg.test(val)) {
        callback(new Error('请输入正确的手机号!'))
      } else {
        callback()
      }
    }
  }],
  email: [{
    required: true,
    message: '邮箱不能为空',
    trigger: 'blur'
  }],
  sex: [{
    required: true,
    message: '性别不为空',
    trigger: 'blur'
  }],
  enpName: [{
    required: false,
    message: '企业名称不能为空',
    trigger: 'blur'
  }],
  // enpType: [{
  //   required: false,
  //   message: '企业类型不能为空',
  //   trigger: 'blur'
  // }],
  companyAddress: [{
    required: true,
    message: '地址不能为空',
    trigger: 'blur'
  }],
  enpContact: [{
    required: true,
    message: '地址不能为空',
    trigger: 'blur'
  }],
  enpPhone: [{
    required: true,
    message: '联系电话不能为空',
    trigger: 'blur'
  }, {
    validator: (rule, val, callback) => {
      if (!reg.test(val)) {
        callback(new Error('请输入正确的手机号!'))
      } else {
        callback()
      }
    }
  }],
  enpPic: [{
    required: false,
    message: '营业执照不能为空',
    trigger: 'blur'
  }],
  enpNo: [{
      required: false,
      message: '营业执照号码不能为空',
      trigger: 'blur'
    },
    // {
    //   validator: (rule, val, callback) => {
    //     if (!reg2.test(val)) {
    //       callback(new Error('请输入正确的营业执照号码!'))
    //     } else {
    //       callback()
    //     }
    //   }
    // }
  ],
  address: [{
    required: true,
    message: '所在区域为空',
    trigger: 'blur'
  }],
};

const userInfo = [{
    label: '用户名',
    value: '-',
    key: 'userName'
  },
  {
    label: '手机号',
    value: '-',
    key: 'phonenumber'
  },
  {
    label: '联系邮箱',
    value: '-',
    key: 'email',
  },
  {
    label: '性别',
    value: '-',
    key: 'sexStr',
  },
  {
    label: '所在区域',
    value: '-',
    key: 'address'
  },
  {
    label: '个人简介',
    value: '-',
    key: 'intro',
  },
  {
    label: 'QQ',
    value: '-',
    key: 'qq'
  },
]
const companyInfo = [{
    label: '企业名称',
    value: '-',
    key: 'enpName'
  },
  {
    label: '邮箱',
    value: '-',
    key: 'email',
  },
  // {
  //   label: '企业类型',
  //   value: '-',
  //   key: 'enpTypeStr'
  // },
  {
    label: '统一社会信用代码(营业执照号码)',
    value: '-',
    key: 'enpNo',
    labelSpan: 8,
    valueSpan: 16
  },
  {
    label: '官网地址',
    value: '-',
    key: 'enpUrl',
  },
  {
    label: '成立日期',
    value: '-',
    key: 'enpDate',
  },
  {
    label: '地址',
    value: '-',
    key: 'enpAllAdress'
  },
  {
    label: '联系人',
    value: '-',
    key: 'enpContact',
  },
  {
    label: '联系电话',
    value: '-',
    key: 'enpPhone',
  },
  {
    label: '企业描述',
    value: '-',
    key: 'enpDesc'
  },
  {
    label: '企业LOGO',
    value: '-',
    key: 'logo',
    isVHtml: true
  },
  {
    label: '营业执照',
    value: '-',
    key: 'enpPic',
    isVHtml: true
  },
]
module.exports = {
  userInfoFromRow,
  companyFromRow,
  userInfo,
  companyInfo,
  formRules
}